<!DOCTYPE HTML>
<html>
<head>
    <title>Error</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <script src="/scripts/miniui/miniui.js"></script>
</head>
<body>
<span style="width:80px;display:inline-block;">用户昵称：</span>
<input id="nickName" class="mini-textbox" style="width:155px;"  />

<span style="width:80px;display:inline-block;margin-left: 30px">电话号码：</span>
<input id="mobilePhoneNumber" class="mini-textbox" style="width:155px;"  />
<br /><br />

<span style="width:80px;display:inline-block;">性别：</span>
<input id="sex" class="mini-combobox" style="width:155px;" data="Genders"/>

<span style="width:80px;display:inline-block;margin-left: 30px">直播权限：</span>
<input id="live" class="mini-combobox" field="id" style="width:155px;" data="liveOptions"/>

<br /><br />

<span style="width:80px;display:inline-block;">登录权限：</span>
<input id="loginStatus" valueField="id" class="mini-combobox" style="width:155px;" data="loginOptions"/>


<span style="width:80px;display:inline-block;margin-left: 30px">用户注册省：</span>
<input id="province" class="mini-textbox"  style="width:155px;"  />

<br /><br />

<span style="width:80px;display:inline-block;">用户注册市：</span>
<input id="city" class="mini-textbox"  style="width:155px;"  />


<span style="width:80px;display:inline-block;margin-left: 30px">Spinner：</span>
<input class="mini-spinner" style="width:155px;"/>

<br /><br />
<div style="margin: 0 auto;text-align: center">
    <a class="mini-button " iconCls="icon-ok" onclick="updataUser()">确定</a>
    <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
</div>
</body>
<script>
    var Genders = [{ id: '男', text: '男' }, { id: '女', text: '女'}];
    var liveOptions = [{ id:1,text:'可以直播'},{id:0,text:'不能直播'}];
    var loginOptions = [{id:'1',text:'允许登陆'},{id:'0',text:'禁止登陆'}];
    function updataUser(){
        var nickName = mini.get("nickName").getValue();
        var mobilePhoneNumber = mini.get("mobilePhoneNumber").getValue();
        var sex = mini.get("sex").getValue();
        var province = mini.get("province").getValue();
        var city =  mini.get("city").getValue();
        var liveStatus = mini.get("live").getValue();
        var loginStatus = mini.get("loginStatus").getValue();
        if(liveStatus=='可以直播'){
            liveStatus=1;
        }else if(liveStatus=='不能直播'){
            liveStatus=0;
        }
        if(loginStatus=='允许登陆'){
            loginStatus=1;
        }else if(loginStatus=='禁止登陆'){
            loginStatus=0;
        }
        $.ajax({
            type:"POST",
            url:"/getdata/updataUser",
            data:{
                objectId:objectId,
                nickName:nickName,
                mobilePhoneNumber:mobilePhoneNumber,
                sex:sex,
                province:province,
                city:city,
                live:live,
                loginStatus:loginStatus,
            },
            success:function (result) {
                CloseWindow("save");
            }
        })
    };
    //    关闭窗口
    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }

</script>
</html>